package com.cizzy.comment.entity.dao;

import com.baomidou.mybatisplus.annotation.TableId;

import java.io.Serial;
import java.io.Serializable;
import java.sql.Timestamp;

import com.baomidou.mybatisplus.annotation.TableName;
import com.cizzy.comment.entity.dto.CommentDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * <p>
 *
 * </p>
 *
 * @author terry
 * @since 2023-11-04
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "Comment对象", description = "")
@TableName("comment")
public class CommentDAO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @TableId("comment_id")
    private Long commentId;

    private Timestamp createAt = new Timestamp(System.currentTimeMillis());

    private Long videoId;

    private Long parentCommentId;

    private Long userId;

    private String content;

    public void convertFromCommentDTO(CommentDTO commentDTO){
        this.commentId = commentDTO.getCommentId();
        this.createAt = commentDTO.getCreateAt();
        this.videoId = commentDTO.getVideoId();
        this.parentCommentId = commentDTO.getParentCommentId();
        this.userId = commentDTO.getUserId();
        this.content = commentDTO.getContent();
    }
}
